home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / basic / rodent.zip / GMOUSCUR.INC < prev    next >
Text File  |  1987-12-13  |  5KB  |  121 lines

  1. { GMOUSCUR.INC is an include file that defines several graphics     }
  2. {    mouse cursor patterns. All are typed constants.                }
  3. { This file also contains an event handler called by the mouse      }
  4. {    device driver, and a global event record variable 'theEvents'  }
  5. { ----------------------------------------------------------------- }
  6.  
  7. {$F+}                { Force the including program to use far calls }
  8.  
  9. TYPE   eventRec = record                       { mouse event record }
  10.            flag, button, col, row : WORD;
  11.        END;
  12.        gCursPtr = ^gCurs;                 { pointer to cursor image }
  13.        gCurs = ARRAY [1..32] OF WORD;          { cursor image array }
  14.        gCursRec = record               { graphics cursor descriptor }
  15.            image      : gCursPtr;
  16.            hotX, hotY : WORD;
  17.        END;
  18.  
  19. { Check mark image }
  20. CONST  checkIm : gCurs = ($FFF0, $FFE0, $FFC0, $FF81, { screen mask }
  21.                           $FF03, $0607, $000F, $001F,
  22.                           $C03F, $F07F, $FFFF, $FFFF,
  23.                           $FFFF, $FFFF, $FFFF, $FFFF,
  24.                           $0000, $0006, $000C, $0018, { cursor mask }
  25.                           $0030, $0060, $70C0, $1D80,
  26.                           $0700, $0000, $0000, $0000,
  27.                           $0000, $0000, $0000, $0000);
  28.  
  29. { Left arrow image }
  30.        LArrIm  : gCurs = ($FE1F, $F01F, $0000, $0000, { screen mask }
  31.                           $0000, $F01F, $FE1F, $FFFF,
  32.                           $FFFF, $FFFF, $FFFF, $FFFF,
  33.                           $FFFF, $FFFF, $FFFF, $FFFF,
  34.                           $0000, $00C0, $07C0, $7FFE, { cursor mask }
  35.                           $07C0, $00C0, $0000, $0000,
  36.                           $0000, $0000, $0000, $0000,
  37.                           $0000, $0000, $0000, $0000);
  38.  
  39. { Cross image }
  40.        crossIm : gCurs = ($FC3F, $FC3F, $FC3F, $0000, { screen mask }
  41.                           $0000, $0000, $FC3F, $FC3F,
  42.                           $FC3F, $FFFF, $FFFF, $FFFF,
  43.                           $FFFF, $FFFF, $FFFF, $FFFF,
  44.                           $0000, $0180, $0180, $0180, { cursor mask }
  45.                           $7FFE, $0180, $0180, $0180,
  46.                           $0000, $0000, $0000, $0000,
  47.                           $0000, $0000, $0000, $0000);
  48.  
  49. { Pointing hand image }
  50.        handIm  : gCurs = ($E1FF, $E1FF, $E1FF, $E1FF, { screen mask }
  51.                           $E1FF, $E000, $E000, $E000,
  52.                           $0000, $0000, $0000, $0000,
  53.                           $0000, $0000, $0000, $0000,
  54.                           $1E00, $1200, $1200, $1200, { cursor mask }
  55.                           $1200, $13FF, $1249, $1249,
  56.                           $1249, $9001, $9001, $9001,
  57.                           $8001, $8001, $8001, $FFFF);
  58.  
  59. { I-beam image }
  60.        iBeamIm : gCurs = ($FFFF, $FFFF, $FFFF, $FFFF, { screen mask }
  61.                           $FFFF, $FFFF, $FFFF, $FFFF,
  62.                           $FFFF, $FFFF, $FFFF, $FFFF,
  63.                           $FFFF, $FFFF, $FFFF, $FFFF,
  64.                           $F00F, $0C30, $0240, $0240, { cursor mask }
  65.                           $0180, $0180, $0180, $0180,
  66.                           $0180, $0180, $0180, $0180,
  67.                           $0240, $0240, $0C30, $F00F);
  68.  
  69. { Graphics cursors }
  70.        check : gCursRec = (image : nil; hotX : 6; hotY : 7);
  71.        arrow : gCursRec = (image : nil; hotX : 0; hotY : 3);
  72.        cross : gCursRec = (image : nil; hotX : 7; hotY : 4);
  73.        hand  : gCursRec = (image : nil; hotX : 5; hotY : 0);
  74.        iBeam : gCursRec = (image : nil; hotX : 7; hotY : 7);
  75. { ----------------------------------------------------------------- }
  76.  
  77. VAR    theEvents : eventRec;                      { global variable }
  78.  
  79. PROCEDURE EventHandler
  80.   (Flags, CS, AX, BX, CX, DX, SI, DI, DS, ES, BP : WORD);
  81.  
  82.      { Mouse event handler called by device driver }
  83.  
  84. INTERRUPT;
  85.  
  86. Begin
  87.   theEvents.flag   := AX;
  88.   theEvents.button := BX;
  89.   theEvents.col    := CX;
  90.   theEvents.row    := DX;
  91.  
  92.   inline (        { Exit processing for far return to device driver }
  93.     $8B/$E5/   { MOV  SP,BP }
  94.     $5D/       { POP  BP }
  95.     $07/       { POP  ES }
  96.     $1F/       { POP  DS }
  97.     $5F/       { POP  DI }
  98.     $5E/       { POP  SI }
  99.     $5A/       { POP  DX }
  100.     $59/       { POP  CX }
  101.     $5B/       { POP  BX }
  102.     $58/       { POP  AX }
  103.     $CB );     { RETF    }
  104. END;
  105. { --------------------------- }
  106.  
  107. PROCEDURE InitGCurs;
  108.  
  109.      { Initialize pointers in graphics cursor descriptors }
  110.      { Pointers can only be initialized at run time }
  111.  
  112. BEGIN
  113.   check.image := @checkIm;
  114.   arrow.image := @LArrIm;
  115.   cross.image := @crossIm;
  116.   hand.image  := @handIm;
  117.   iBeam.image := @iBeamIm;
  118. END;
  119.  
  120. { End of gmouscur.inc }
  121.